package com.example.demo.order.service.impl;

import com.example.demo.order.dao.OrderMapper;
import com.example.demo.order.entity.Order;
import com.example.demo.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;


    /**
     * 查询多个订单
     * @param order
     * @返回值 List<Order> 用户集合
     */
    @Override
    public List<Order> findList(Order order) {

        List<Order> list = orderMapper.findList(order);

        return list;
    }


    /**
     * 查询1个订单
     * @param id
     * @返回值 List<Order> 用户集合
     */
    @Override
    public Order findOne(String id) {
        Order order = orderMapper.selectByPrimaryKey(id);

        return order;
    }

    /**
     * 删除1个订单
     * @param id
     * @返回值 List<Order> 用户集合
     */
    @Override
    public void remove(String id) {

        orderMapper.deleteByPrimaryKey(id);
    }

    /**
     * 新增订单
     * @param order
     * @返回值 List<Order> 用户集合
     */
    @Override
    public void save(Order order) {

        orderMapper.insert(order);
    }

    /**
     * 修改订单
     * @param order
     * @返回值 List<Order> 用户集合
     */
    @Override
    public void update(Order order) {

        orderMapper.updateByPrimaryKey(order);
    }
}
